<div class="giveHeight"> 
    <table class="responsive dynamicTable display table table-bordered dataTable">
        <thead>        
            <tr>
{# sorting of properties based on query components #}
                    {{ knp_pagination_sortable(pagination, 'N° Bon Retour', 'b.reference') }}
                                {{ knp_pagination_sortable(pagination, 'Raison Social', 'b.client') }}
                <th>Departement</th>
                <th>Date</th>
                <th>Heure</th>
                <th>Montant TTc</th>
                <th>Reste</th>
                <th>Action</th>
            </tr>
        </thead>

{# table body #}
{% for bon_retour in pagination %}
        <tr {% if loop.index is odd %}class="color"{% endif %}>
            <td style="width:10%;text-align: center">{{ bon_retour.reference }}</td>
            <td style="width:15%">{{ bon_retour.client }}</td>
            <td style="width:15%">{{ bon_retour.departement }}</td>
            <td style="width:10%">{{ bon_retour.date|date('d/m/Y') }} </td>
            <td style="width:5%"> {{ bon_retour.getTime }}</td>
            <td style="width:13%">{{ bon_retour.montantTtc|number_format(3) }}</td>
            <td style="width:13%">{{ bon_retour.reste|number_format(3) }}</td>
            <td class="center ">
                <div class="controls center">
                    <a class="tip" href="javascript:showBonRetour('{{bon_retour.id}}')" title="Visualiser">
                        <span class="icon12 icon-eye-open"></span>
                    </a>                            
                    <a  style="padding-left:5%;padding-right: 5%" class="tip" href="javascript:imprimerBonRetour('{{bon_retour.id}}')" title="Imprimer">
                        <span class="icon12 icon-print"></span>
                    </a>
                </div>
            </td>
        </tr>
{% endfor %}
    </table>
</div>
<div id="DataTables_Table_0_info" class="dataTables_info">Affichage de {{ (pagination.getCurrentPageNumber -1)*pagination.getItemNumberPerPage + 1}} à {{ (pagination.getCurrentPageNumber -1)*pagination.getItemNumberPerPage + pagination.getItemNumberPerPage}} de {{ pagination.getTotalItemCount }} BonLivraison</div>
{# display navigation #}
<div id="DataTables_Table_0_paginate" class="dataTables_paginate paging_full_numbers">
    {{ knp_pagination_render(pagination) }}
</div>
<script>
    function showBonRetour(id) {
        lf = remplirlf()
        $.ajax({
            url: '{{path('gds_vente_bon_retour_show')}}',
            mode: "abort",
            data: 'id=' + id,
            success: function(data) {
                $('#div_liste_bon_retour').html(data)
            }
        })
    }
    function imprimerBonRetour(id) {
        $.ajax({
            url: '{{path('gds_vente_bon_retour_print_saved')}}',
            type: "POST",
            data: "id=" + id,
            mode: "abort",
            success: function(data) {
                $.msgBox({
                    title: "Bon Retour",
                    content: "Imression effectué avec succés",
                    type: "info"
                });
            }
        })
    }
    function remplirlf() {
        var liste_f = new Array()
        liste_f[0] = $('#filtre_numero').val()
        liste_f[1] = $('#client').val()
        liste_f[2] = date1
        liste_f[3] = date2
        liste_f[8] = $('#filtre_ttc1').val()
        liste_f[9] = $('#filtre_ttc2').val()
        liste_f[12] = $('#departement').val()
        return liste_f
    }
</script>
